﻿using System;
using System.Data;
using System.IO;
using System.Web;
using System.Text;

/// <summary>
///Log 的摘要说明
/// </summary>
public class Log
{
    public Log()
    {
        //
        //TODO: 在此处添加构造函数逻辑
        //
    }
    public static void WriteLog(string Message)
    {

        string dirName = HttpContext.Current.Server.MapPath("~") + "\\Log\\" + DateTime.Now.ToString("yyyy\\\\MM\\\\dd");
        string fileName = dirName + "\\Log.txt";
        if (!Directory.Exists(dirName))
        {
            Directory.CreateDirectory(dirName);
        }
        if (!File.Exists(fileName))
        {
            File.Create(fileName).Close();
        }
        using (StreamWriter sw = new StreamWriter(fileName, true, Encoding.UTF8))
        {
            sw.WriteLine("\r\n" + System.DateTime.Now.ToString() + "\t" + Message);
            sw.Close();
        }
    }

}
